package thread;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @Author liangzai
 * @Description:
 */
public class Demo2 {
    public static void main(String[] args) {
        //ExecutorService threadpools2 = Executors.newCachedThreadPool();
        ExecutorService threadpools = Executors.newFixedThreadPool(4);
        for (int i = 0; i <= 100; i++) {
            int id = i;
            threadpools.submit(()->{
                System.out.println(Thread.currentThread().getName()+" "+id);
            });
        }

    }
}










